package com.wl.dzt.basic.user;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wl_code@163.com
 * @version 1.0
 * @date 2018/7/10/010
 * @description 存储登陆人相关信息
 */
public class User implements Serializable {
    /**
     * 系统用户
     */
    private Object systemUser;
    /**
     * 登陆信息存储
     */
    private Map<String, Object> userInof = new HashMap<>();
    /**
     * 系统配置
     */
    private Map<String, Object> config = new HashMap<>();

    /**
     * 是否是管理员
     */
    public boolean isAdmin() {
        return (boolean) this.getAttr("isAdmin");
    }

    /**
     * 构建配置
     */
    public void builderConfig(Map<String, Object> config) {
        this.config = config;
    }

    /**
     * 获取配置
     */
    public Map<String, Object> getConfig() {
        return this.config;
    }

    /**
     * <b>添加属性</b>
     *
     * @param key
     * @param value
     */
    public void addAttr(String key, Object value) {
        userInof.put(key, value);
    }

    /**
     * <b>删除属性</b>
     *
     * @param key
     */
    public void delAttr(String key) {
        userInof.remove(key);
    }

    /**
     * <b>获取属性</b>
     *
     * @param key
     * @return
     */
    public Object getAttr(String key) {
        return userInof.get(key);
    }

    public Object getSystemUser() {
        return systemUser;
    }

    public void setSystemUser(Object systemUser) {
        this.systemUser = systemUser;
    }

    public Map<String, Object> getUserInof() {
        return userInof;
    }

}
